Repository navigation
[1404] tps 输出 token 计数改为 human readable 紧凑记法 - #17
Merged
Merged
Conversation
将 tps.scm 的 token 计数格式化从千分位逗号分组改为 K/M 紧凑记法: - < 1000 输出整数(如 414、848); - >= 1000 用 K/M 后缀并保留 1 位小数(如 15808 -> 15.8K,2531749 -> 2.5M)。 TPS 与耗时(秒)仍保留 1 位小数。 替换 %group-digits/%format-grouped 为 %fixed-decimals + %human-readable, 并清理不再使用的 (liii string) 导入。同步更新 tps-test.scm 断言。
新增 %format-duration 把耗时(秒)格式化为紧凑时长: - < 60s 29.4s(秒保留 1 位小数) - < 3600s 1m30s(余秒非零)或 12m(整分) - >= 3600s 1h5m 替换此前 %human-readable elapsed-s 对耗时套用 K/M 后缀的写法 (否则 90s 会变成 90s,超过 1000s 会变成 1.0Ks,不合理)。 注:liii date-time 的 time-delta 不归一化分量、无字符串格式化, 故自写 %format-duration。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
TPS 扩展(
extensions/tps.scm)在 agent 运行结束时输出一行 token 吞吐量统计,此前 token 计数采用千分位逗号分组:改动
将 token 计数格式化改为 K/M 紧凑记法(K=10³,M=10⁶),更易读:
< 1000输出整数(如414、848);>= 1000用 K/M 后缀并保留 1 位小数(如15808 -> 15.8K,2531749 -> 2.5M);38.5 tok/s、10.8s)。实现
%group-digits/%format-grouped,新增%fixed-decimals(指定位数小数)与%human-readable(K/M 紧凑记法,原值档位与 K/M 档位分别可配小数位)。%tps-line中 TPS/耗时使用 raw-digits=1、token 计数使用 raw-digits=0、统一 km-digits=1。(liii string)导入(原仅string-join用到)。tests/liii/pi/extensions/tps-test.scm的断言。测试